New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tiny improvements of Range for X19 #2272
Conversation
@@ -1,6 +1,7 @@ | |||
# -*- encoding: us-ascii -*- | |||
|
|||
class Range | |||
# Don't use `alias_method` for #===. `Delegate to #include?` is a spec. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is defined as the spec, we should also add a RubySpec for this behavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry spec is range/case_compare_spec.
But I want to this comment to here for readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, sorry from my side, I didn't realize it was just adding this as a comment and not changing the actual code. Were you surprised by this behavior? Behavior like this exists is various other places in Ruby and we don't have comments in all the other places. The upside of actually having a spec for this, is that even if people would think about changing it, the spec would fail and would tell people exactly what is wrong. So I don't really see a big advantage of adding this comment here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was very surprised this behavior :)
And i was helped by a coment from non updated version guard in spec
But this is my problem, you are right !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, adding comments like this is often a balancing act. Since the case of a certain being implement with another and not an alias happens in a few more places, it's not that much an edge case as probably the case you mentioned. I remember fixing 17e1e62, but didn't add a comment for that case either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great reference! Thanks!
Prefer protected to private -------------------------------------- * This method is just used by `self.each`. Replace receiver for X19 ------------------------ * `first` is gotten the `self.each` refer ----- * rubinius#2272 * rubinius#2272
Prefer protected to private -------------------------------------- * This method is just used by `self.each`. Replace receiver for X19 ------------------------ * `first` is gotten the `self.each` refer ----- * rubinius#2272 (diff) * rubinius#2272
Prefer protected to private -------------------------------------- * This method is just used by `self.each`. Replace receiver for X19 ------------------------ * `first` is gotten the `self.each` refer ----- * rubinius#2272 (diff) * rubinius#2272
No description provided.